﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<skags.Models.UserTablesViewModel>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Notendur
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="main">
    <h2>Notendur</h2>
    <table>
        <tr>
            <td><a href="/Admin/CreateUser"><img src="../../Content/icons/create.png" alt="Nýr notandi" /></a></td>
            <th>
                ID
            </th>
            <th>
                Notandanafn
            </th>
            <th>
                Síðast virkur
            </th>
            <th>
                Nafn
            </th>
            <th>
                Óþægur?
            </th>
            <th>
                Stjórnandi?
            </th>
            <th>
                Fagmaður?
            </th>
        </tr>

    <% foreach (var item in Model) { %>
    
        <tr>
            <td>
                <a href="/Admin/DeleteUser/<%= item.ID %>" onclick="return confirm('Ertu viss um að þú viljir eyða þessum notanda?')"><img src="../../Content/icons/delete.png" alt="Eyða" /></a>
                &nbsp;
                <a href="/Admin/EditUser/<%= item.ID %>"><img src="../../Content/icons/edit.png" alt="Breyta" /></a>
            </td>
            <td>
                <%: item.ID %>
            </td>
            <td>
                <%: item.UserName %>
            </td>
            <td>
                <%: String.Format("{0:g}", item.LastActive) %>
            </td>
            <td>
                <%: item.FullName %>
            </td>
            <td>
                <%= item.IsNaughty ? "Já" : "Nei"%>
            </td>
            <td>
                <a href="/Admin/UpdateRole/<%= item.ID %>/?role=Admin"><%= item.RoleName == "Admin" ? "<img src=\"../../Content/icons/true.png\" alt=\"\" />" : "<img src=\"../../Content/icons/false.png\" alt=\"\" />"%></a>
            </td>
            <td>
                <a href="/Admin/UpdateRole/<%= item.ID %>/?role=Fagfolk"><%= item.RoleName == "Fagfolk" ? "<img src=\"../../Content/icons/true.png\" alt=\"\" />" : "<img src=\"../../Content/icons/false.png\" alt=\"\" />"%></a>
            </td>
        </tr>
    
    <% } %>

    </table>
</div>
</asp:Content>

